<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- 下拉框 -->
    <link rel="stylesheet" href="static/ace/css/chosen.css"/>
    <!-- jsp文件头和头部 -->
    <%@ include file="../base/top.jsp" %>
    <!-- 日期框 -->
    <link rel="stylesheet" href="static/ace/css/datepicker.css"/>
</head>
<body class="no-skin">
<div class="main-container" id="main-container">
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <input id="success" style="display: none"/>
                        <input id="talent-training-programId" style="display: none"/>
                        <input id="msg" style="display: none"/>
                        <form  id="talent-form">
                            <table id="table_report" class="table table-striped table-bordered table-hover">
                                <tr>
                                    <td style="width:79px;text-align: right;padding-top: 13px;">实施年份:</td>
                                    <td id="juese">
                                        <div>
                                            <input type="text" class="form-control form-filter yearpicker" readonly name="awardYear" id="award-year" />
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:79px;text-align: right;padding-top: 13px;">文&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;件:</td>
                                    <td>
                                        <input type="file" id="file" name="file" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="text-align: center;" colspan="10">
                                        <a class="btn btn-mini btn-primary" onclick="save();">保存</a>
                                        <a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.page-content -->
        </div>
    </div>
    <!-- /.main-content -->
</div>
<!-- /.main-container -->

<!-- 页面底部js¨ -->
<%@ include file="../base/foot.jsp"%>
<!-- 日期框 -->
<script src="static/ace/js/date-time/bootstrap-datepicker.js"></script>
<script src="static/moment.js"></script>
<script type="text/javascript">
    $(function() {
        $('#file').ace_file_input({
            no_file:'上传人才培养方案 ',
            btn_choose:'选择',
            btn_change:'更改',
            droppable:false,
            onchange:null,
            thumbnail:false, //| true | large
            whitelist:'*',
        });
    });

    $(function() {
        //日期框
        $('.date-picker').datepicker({autoclose: true, todayHighlight: true});

        //年份选择框
        $(".yearpicker").datepicker({
            startView: 'decade',
            minView: 'decade',
            format: 'yyyy',
            maxViewMode: 2,
            minViewMode:2,
            autoclose: true
        });

        if('${dotype}'=='edit'){
            <c:if test="${not empty talentTrainingProgramInfo}">
                var date = "${talentTrainingProgramInfo.talentTrainingProgramAwardYear}";
                var now=moment(date).format("YYYY");
                $("#award-year").val(now);
            </c:if>
        }
    });

    function save() {
        var data = new FormData(document.getElementById("talent-form"));
        $.ajax({
            type:"POST",
            url:"<%= basePath%>talentTrainingProgram/${dotype}",
            data:data,
            processData:false,
            contentType:false,
            success:function (data) {
                $("#success").val(data["success"]);
                $("#msg").val(data["msg"]);
                //关闭一定要写在ajax执行完成之后
                top.Dialog.close();
            }
        })
    }

</script>
</body>
</html>
